package dongshi.daddy.abstractfactory.factory;

import dongshi.daddy.abstractfactory.product.Brake;
import dongshi.daddy.abstractfactory.product.Wheel;
import dongshi.daddy.abstractfactory.product.bicycle.Bicycle;
import dongshi.daddy.abstractfactory.product.bicycle.BicycleBrake;
import dongshi.daddy.abstractfactory.product.bicycle.BicycleWheel;

public class BicycleFactory extends AbstractFactory<BicycleBrake, BicycleWheel, Bicycle> {
    @Override
    protected BicycleBrake createBrake() {
        return new BicycleBrake();
    }

    @Override
    protected BicycleWheel createWheel() {
        return new BicycleWheel();
    }

    @Override
    public Bicycle createProduct() {
        Brake brake = createBrake();
        brake.brake();
        Wheel wheel = createWheel();
        wheel.run();
        return new Bicycle(brake, wheel);
    }
}
